package com.yanfan.data.service.impl;

import com.yanfan.common.utils.DateUtils;
import com.yanfan.data.domain.AddDataSimCardVo;
import com.yanfan.data.domain.DataSimCardRequestParam;
import com.yanfan.data.mapper.DataSimCardRequestParamMapper;
import com.yanfan.data.service.DataSimCardRequestParamService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DataSimCardRequestParamServiceImpl implements DataSimCardRequestParamService {
    @Autowired
    private DataSimCardRequestParamMapper dataSimCardRequestParamMapper;

    /**
     * 查询流量卡请求参数
     *
     * @param id 流量卡请求参数主键
     * @return 流量卡请求参数
     */
    @Override
    public DataSimCardRequestParam selectDataSimCardRequestParamById(Long id) {
        return dataSimCardRequestParamMapper.selectDataSimCardRequestParamById(id);
    }

    /**
     * 查询流量卡请求参数列表
     *
     * @param dataSimCardRequestParam 流量卡请求参数
     * @return 流量卡请求参数
     */
    @Override
    public List<DataSimCardRequestParam> selectDataSimCardRequestParamList(DataSimCardRequestParam dataSimCardRequestParam) {
        return dataSimCardRequestParamMapper.selectDataSimCardRequestParamList(dataSimCardRequestParam);
    }

    /**
     * 新增流量卡请求参数
     *
     * @param dataSimCardRequestParam 流量卡请求参数
     * @return 结果
     */
    @Override
    public int insertDataSimCardRequestParam(DataSimCardRequestParam dataSimCardRequestParam) {
        dataSimCardRequestParam.setCreateTime(DateUtils.getNowDate());
        return dataSimCardRequestParamMapper.insertDataSimCardRequestParam(dataSimCardRequestParam);
    }

    /**
     * 修改流量卡请求参数
     *
     * @param dataSimCardRequestParam 流量卡请求参数
     * @return 结果
     */
    @Override
    public int updateDataSimCardRequestParam(DataSimCardRequestParam dataSimCardRequestParam) {
        dataSimCardRequestParam.setUpdateTime(DateUtils.getNowDate());
        return dataSimCardRequestParamMapper.updateDataSimCardRequestParam(dataSimCardRequestParam);
    }

    /**
     * 批量删除流量卡请求参数
     *
     * @param ids 需要删除的流量卡请求参数主键
     * @return 结果
     */
    @Override
    public int deleteDataSimCardRequestParamByIds(Long[] ids) {
        return dataSimCardRequestParamMapper.deleteDataSimCardRequestParamByIds(ids);
    }

    /**
     * 删除流量卡请求参数信息
     *
     * @param id 流量卡请求参数主键
     * @return 结果
     */
    @Override
    public int deleteDataSimCardRequestParamById(Long id) {
        return dataSimCardRequestParamMapper.deleteDataSimCardRequestParamById(id);
    }

    @Override
    public DataSimCardRequestParam selectDataSimCardRequestParam(AddDataSimCardVo addDataSimCardVo) {
        return dataSimCardRequestParamMapper.selectDataSimCardRequestParam(addDataSimCardVo.getAppId(), addDataSimCardVo.getAppSecret(), addDataSimCardVo.getIccId());
    }
}
